package com.dashu.device.service.HQ;


import com.dashu.base.bean.device.HQ.HQDevicePicAddReq;
import com.dashu.base.bean.device.HQ.HQDevicePicDelReq;
import com.dashu.base.bean.device.HQ.HQDevicePicUpdReq;
import com.dashu.base.bean.device.HQ.HQDeviceRemoteOpenReq;
import com.dashu.base.bean.device.HQ.base.HQPicAddBean;
import com.dashu.base.bean.device.HQ.base.HQPicDelBean;
import com.dashu.base.bean.device.HQ.base.HQPicUpdBean;
import com.dashu.base.bean.device.HQ.base.HQRemoteOpenBean;
import com.dashu.base.bean.device.JL.resp.JLDevicePicListResp;
import com.dashu.device.api.HQ.HQExternalApi;
import com.dashu.device.dto.DeviceOpenDoorRespDTO;
import com.dashu.device.dto.DevicePicAddRespDTO;
import com.dashu.device.dto.DevicePicDelRespDTO;
import com.dashu.device.dto.DevicePicUpdRespDTO;
import com.dashu.base.vo.DeviceOpenDoorReqVO;
import com.dashu.base.vo.DevicePicAddVO;
import com.dashu.base.vo.DevicePicDelReqVO;
import com.dashu.base.vo.DevicePicUpdReqVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.util.TextUtils;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;

@Slf4j
@Service
public class HQInsideExternalService<T> implements HQExternalApi<T> {

//    @Value("${device.jl_path}")
//    private String jl_path;

    @Override
    public DevicePicAddRespDTO<T> addUser(DevicePicAddVO<T> req) throws UnsupportedEncodingException {
        HQDevicePicAddReq picAddReq = new HQDevicePicAddReq();
        picAddReq.setOperator("AddPerson");
        if (!TextUtils.isEmpty(""))
            picAddReq.setPicinfo("");
        HQPicAddBean picAddBean = new HQPicAddBean();
        picAddBean.setDeviceID("");
        picAddBean.setPersonUUID("");
        picAddBean.setNotes(req.getIden().toString());
        picAddBean.setName("");
        picAddReq.setInfo(picAddBean);
        return null;
    }

    @Override
    public DevicePicDelRespDTO<T> delPic(DevicePicDelReqVO<T> req) throws UnsupportedEncodingException {
        HQDevicePicDelReq picDelReq = new HQDevicePicDelReq();
        picDelReq.setOperator("DeletePerson");
        HQPicDelBean picDelBean = new HQPicDelBean();
        picDelBean.setDeviceID("");
        picDelBean.setPersonUUID(new String[]{""});
        picDelBean.setTotalNum(1);
        picDelReq.setInfo(picDelBean);
        return null;
    }

    @Override
    public DevicePicUpdRespDTO<T> updPic(DevicePicUpdReqVO<T> req) throws UnsupportedEncodingException {
        HQDevicePicUpdReq picUpdReq = new HQDevicePicUpdReq();
        picUpdReq.setOperator("EditPerson");
        if (!TextUtils.isEmpty(""))
            picUpdReq.setPicinfo("");
        HQPicUpdBean picUpdBean = new HQPicUpdBean();
        picUpdBean.setDeviceID("");
        picUpdBean.setPersonUUID("");
        picUpdBean.setNotes(req.getIden().toString());
        picUpdBean.setName("");
        picUpdReq.setInfo(picUpdBean);
        return null;
    }

    @Override
    public DeviceOpenDoorRespDTO<T> openDoor(DeviceOpenDoorReqVO<T> req) {
        HQDeviceRemoteOpenReq remoteOpenReq = new HQDeviceRemoteOpenReq();
        remoteOpenReq.setOperator("OpenDoor");
        HQRemoteOpenBean remoteOpenBean = new HQRemoteOpenBean();
        remoteOpenBean.setDeviceID("");
        remoteOpenReq.setInfo(remoteOpenBean);
        return null;
    }


    public JLDevicePicListResp GetList() throws UnsupportedEncodingException {
        return null;
    }
}
